/*定义一个函数，实现和instanceof相同的功能*/
function Dog() {
}
let dog = new Dog()
function Cat() {
}

function A(a, b) {
    let proto = Object.getPrototypeOf(a)
    let prototype = b.prototype
    while (true) {
        if (proto == null)
            return false
        if (proto == prototype)
            return true
        proto = Object.getPrototypeOf(proto)
    }
}
console.log(dog instanceof Dog);
console.log(A(dog, Dog));
console.log(dog instanceof Object);
console.log(A(dog, Object));
console.log(dog instanceof Cat);
console.log(A(dog, Cat));